import { http } from "@/utils/http";

import type { Result } from "@/api/typeConfig";

export const getList = params =>
  http.request<Result>("get", "/system/warehouse/list", {
    params
  });

export const allListApi = () =>
  http.request<Result>("get", "/system/warehouse/all/select");
/* 修改工具室状态 */
export const stateApi = params =>
  http.request<Request>("put", "/system/warehouse/editState", { params });

/* 新增工具室 */
export const addApi = data =>
  http.request<Request>("post", "/system/warehouse", { data });
/* 编辑工具室 */
export const editApi = data =>
  http.request<Request>("put", "/system/warehouse", { data });

/* 导出excel表格 */
export const excelApi = data =>
  http.request<Request>("post", "/system/warehouse/export", {
    data,
    responseType: "blob"
  });

/* 批量删除 */
export const delApi = data =>
  http.request<Result>("delete", `/system/warehouse/${data.warehouseIds}`, {
    data
  });

/* 字典 */
export const dictApi = params =>
  http.request<Result>("get", `/system/warehouseConfig/${params.warehouseId}`);

export const editDictApi = data =>
  http.request<Result>("post", "/system/warehouseConfig", { data });
